package Agency.views;
import java.awt.Color;
import javax.swing.JButton;
import javax.swing.table.DefaultTableModel;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author wangari
 * 
 */
public class AllTenantsView extends javax.swing.JFrame {
    //creates an array to hold the columns of the table
     String [] myArray = {"TennatsName", " Id Number", "Phone No", "House Type","HousePlotNum","House ID","Town","Gender","Occupation"};
      
        DefaultTableModel tenanntsTable= new DefaultTableModel(myArray,0);  
    /**
     * Creates new form AllTenantsView and sets the background color to light gray
     */
    public AllTenantsView() {
        this.getContentPane().setBackground(Color.LIGHT_GRAY);
        initComponents();
        setLocationRelativeTo(null);
       
    }
    /**
     * DefaultTableModel that shows all the tenants
     * @return tenanntsTable;

     */
    public DefaultTableModel myTenantsTable(){
        return tenanntsTable;
    }
    /**
     * button  to display all the tenants
     * @return jBDisplay
     */
    public JButton displayButton(){
        return jBDisplay;
    }
    /**
     * Button to close the view
     * @return jBClose
     */
    public JButton closeButton(){
        return jBClose;
    }
    /**
     * Button that exports data from the Array list to a text file for better viewing
     */
    public JButton exportData(){
        return jBExportData;
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jScrollPane1 = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable();
        jBDisplay = new javax.swing.JButton();
        jBClose = new javax.swing.JButton();
        jBExportData = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jTable1.setModel(tenanntsTable);
        jScrollPane1.setViewportView(jTable1);

        jBDisplay.setText("DisplayData");

        jBClose.setText("Close");

        jBExportData.setText("Export Data");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(jBDisplay))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jBClose)
                        .addGap(0, 0, Short.MAX_VALUE))
                    .addComponent(jBExportData, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 633, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 476, Short.MAX_VALUE))
            .addGroup(layout.createSequentialGroup()
                .addGap(77, 77, 77)
                .addComponent(jBDisplay)
                .addGap(112, 112, 112)
                .addComponent(jBExportData, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jBClose)
                .addGap(25, 25, 25))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

   


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jBClose;
    private javax.swing.JButton jBDisplay;
    private javax.swing.JButton jBExportData;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTable jTable1;
    // End of variables declaration//GEN-END:variables
}
